<%@ page language="java" pageEncoding="UTF-8" isELIgnored="false" %>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<HTML>
<HEAD>
    <meta http-equiv="Content-Language" content="zh-cn">
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <link rel="stylesheet" href="${pageContext.request.contextPath}/css/bootstrap.min.css" type="text/css" />
    <script src="${pageContext.request.contextPath}/js/jquery-1.11.3.min.js" type="text/javascript"></script>
    <script src="${pageContext.request.contextPath}/js/bootstrap.min.js" type="text/javascript"></script>
    <!-- 引入自定义css文件 style.css -->
    <link rel="stylesheet" href="${pageContext.request.contextPath}/css/style.css" type="text/css" />

    <script src="${pageContext.request.contextPath}/js/jquery-1.11.3.min.js"
            type="text/javascript"></script>
    <script src="${pageContext.request.contextPath}/js/bootstrap.min.js"
            type="text/javascript"></script>
    <!-- 引入自定义css文件 style.css -->
    <link rel="stylesheet" href="${pageContext.request.contextPath}/css/style.css" type="text/css"/>
    <script>
        function showDetail(oid) {
            //alert(oid);
            $.post("${pageContext.request.contextPath}/getDetailByOid",
                   {oid: oid},
                   function (data) {
                       var s = "<table width='99%' border='1'><tr><th>商品名称</th><th>购买数量</th></tr>";
                       $(data).each(function () {
                           s +=
                               ("<tr><td>" + this.product.pname + "</td><td>" + this.count
                                + "</td></tr>");
                       });
                       s += "</table>";

                       layer.open({
                                      type: 1,//0:信息框; 1:页面; 2:iframe层;	3:加载层;	4:tip层
                                      title: "订单详情",//标题
                                      area: ['450px', '300px'],//大小
                                      shadeClose: true, //点击弹层外区域 遮罩关闭
                                      content: s//内容
                                  });
                   }, "json");
        }
    </script>
</HEAD>
<body>
<br>
<form id="Form1" name="Form1" action="${pageContext.request.contextPath}/order/list.jsp"
      method="post">
    <table cellSpacing="1" cellPadding="0" width="100%" align="center" bgColor="#f5fafe" border="0">
        <TBODY>
        <tr>
            <td class="ta_01" align="center" bgColor="#afd1f3">
                <strong>订单列表</strong>
            </TD>
        </tr>

        <tr>
            <td class="ta_01" align="center" bgColor="#f5fafe">
                <table cellspacing="0" cellpadding="1" rules="all"
                       bordercolor="gray" border="1" id="DataGrid1"
                       style="BORDER-RIGHT: gray 1px solid; BORDER-TOP: gray 1px solid; BORDER-LEFT: gray 1px solid; WIDTH: 100%; WORD-BREAK: break-all; BORDER-BOTTOM: gray 1px solid; BORDER-COLLAPSE: collapse; BACKGROUND-COLOR: #f5fafe; WORD-WRAP: break-word">
                    <tr
                            style="FONT-WEIGHT: bold; FONT-SIZE: 12pt; HEIGHT: 25px; BACKGROUND-COLOR: #afd1f3">

                        <td align="center" width="10%">
                            序号
                        </td>
                        <td align="center" width="10%">
                            订单编号
                        </td>
                        <td align="center" width="10%">
                            订单金额
                        </td>
                        <td align="center" width="10%">
                            收货人
                        </td>
                        <td align="center" width="10%">
                            订单状态
                        </td>
                        <td align="center" width="50%">
                            订单详情
                        </td>
                    </tr>
                    <c:forEach items="${orders}" var="o" varStatus="v">
                        <tr onmouseover="this.style.backgroundColor = 'white'"
                            onmouseout="this.style.backgroundColor = '#F5FAFE';">
                            <td style="CURSOR: hand; HEIGHT: 22px" align="center"
                                width="18%">
                                    ${v.count}
                            </td>
                            <td style="CURSOR: hand; HEIGHT: 22px" align="center"
                                width="17%">
                                <input readonly name="oid" value="${o.oid}" hidden="true">
                                    ${o.oid}
                            </td>
                            <td style="CURSOR: hand; HEIGHT: 22px" align="center"
                                width="17%">
                                    ${o.total}
                            </td>
                            <td style="CURSOR: hand; HEIGHT: 22px" align="center"
                                width="17%">
                                    ${o.name}
                            </td>
                            <td style="CURSOR: hand; HEIGHT: 22px" align="center"
                                width="17%">
                                <c:if test="${o.state==0}">
                                  未付款
                                </c:if>
                                <c:if test="${o.state==1}">
                                  <a href='${pageContext.request.contextPath }/updateState?oid=${o.oid}&state=2'>
                                    发货
                                  </a>
                                </c:if>
                                <c:if test="${o.state==2}">
                                  等待确认收货
                                </c:if>
                                <c:if test="${o.state==3}">
                                  已完成
                                </c:if>

                            </td>
                            <td align="center" style="HEIGHT: 22px">
                              <a type="button" href="${ pageContext.request.contextPath }/admin/getDetailByOid.do?oid=${o.oid}" style="color: #0f0f0f">
                              <input name="订单详情" type="button" id="btn" value="订单详情">
                              </a>
                            </td>
                        </tr>
                    </c:forEach>
                </table>
            </td>
        </tr>
        </TBODY>
    </table>
</form>
<nav aria-label="Page navigation" >
  <ul class="pagination" style="margin-left: 40%">
    <c:if test="${page.isFirstPage == true}">
      <li class="disabled">
        <a href="${pageContext.request.contextPath}/admin/adminOrderList.do?pageNum=0" aria-label="Previous">
          <span aria-hidden="true">首页</span>
        </a>
      </li>
    </c:if>
    <c:if test="${page.isFirstPage != true}">
      <li>
        <a href="${pageContext.request.contextPath}/admin/adminOrderList.do?pageNum=0" aria-label="Previous">
          <span aria-hidden="true">首页</span>
        </a>
      </li>
    </c:if>
    <c:if test="${page.isFirstPage == true}">
      <li class="disabled">
        <a href="${pageContext.request.contextPath}/admin/adminOrderList.do?pageNum=${page.prePage}" aria-label="Previous">
          <span aria-hidden="true">上一页</span>
        </a>
      </li>
    </c:if>
    <c:if test="${page.isFirstPage != true}">
      <li>
        <a href="${pageContext.request.contextPath}/admin/adminOrderList.do?pageNum=${page.prePage}" aria-label="Previous">
          <span aria-hidden="true">上一页</span>
        </a>
      </li>
    </c:if>
    <c:forEach begin="${page.navigateFirstPage}" end="${page.navigateLastPage}" var="item" step="1">
      <c:if test="${item == page.pageNum}">
        <li class="active">
          <a href="${pageContext.request.contextPath}/admin/adminOrderList.do?pageNum=${item}">${item}</a>
        </li>
      </c:if>
      <c:if test="${item != page.pageNum}">
        <li>
          <a href="${pageContext.request.contextPath}/admin/adminOrderList.do?pageNum=${item}">${item}</a>
        </li>
      </c:if>
    </c:forEach>
    <c:if test="${page.isLastPage == true}">
      <li class="disabled">
        <a href="${pageContext.request.contextPath}/admin/adminOrderList.do?pageNum=${page.nextPage}" aria-label="Next">
          <span aria-hidden="true">下一页</span>
        </a>
      </li>
    </c:if>
    <c:if test="${page.isLastPage != true}">
      <li>
        <a href="${pageContext.request.contextPath}/admin/adminOrderList.do?pageNum=${page.nextPage}" aria-label="Next">
          <span aria-hidden="true">下一页</span>
        </a>
      </li>
    </c:if>
    <c:if test="${page.isLastPage == true}">
      <li class="disabled">
        <a href="${pageContext.request.contextPath}/admin/adminOrderList.do?pageNum=${page.pages}" aria-label="Next">
          <span aria-hidden="true">尾页</span>
        </a>
      </li>
    </c:if>
    <c:if test="${page.isLastPage != true}">
      <li>
        <a href="${pageContext.request.contextPath}/admin/adminOrderList.do?pageNum=${page.pages}" aria-label="Next">
          <span aria-hidden="true">尾页</span>
        </a>
      </li>
    </c:if>
  </ul>
</nav>
</body>
</HTML>

